
#import "PUTopCollectionCell.h"

@implementation PUTopCollectionCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupViews];
    }
    return self;
}

- (void)setupViews {
    self.iconImageView = [[UIImageView alloc]init];
    self.iconImageView.contentMode = UIViewContentModeScaleAspectFill;
    self.iconImageView.backgroundColor = UIColor.whiteColor;
    self.iconImageView.clipsToBounds = true;
    [self addSubview:self.iconImageView];
    [self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.offset = 0;
    }];
    
    self.topImageView = [[UIImageView alloc]init];
    self.topImageView.image = [UIImage imageNamed:@"第一"];
    [self addSubview:self.topImageView];
    [self.topImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.offset = 0;
        make.width.offset = 25;
        make.height.offset = 34;
    }];
    
    self.titleLabel = [[UILabel alloc]init];
    self.titleLabel.text = @"家常菜";
    self.titleLabel.textColor = UIColor.whiteColor;
    self.titleLabel.font = [UIFont systemFontOfSize:12];
    [self addSubview:self.titleLabel];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.offset(0);
        make.bottom.offset = -10;
    }];
}

- (void)setModel:(PUFoodModel *)model {
    self.titleLabel.text = model.name;
    [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:model.cover]];
}

@end
